package EjemplosStreamBytes;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Date;

public class StreamBytes2 {

	public static void main(String[] args) {
		Date date = new Date();
		try {
			FileOutputStream a = new FileOutputStream("testSer2.ser");
			ObjectOutputStream b = new ObjectOutputStream(a);
			b.writeObject(date);
			b.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			FileInputStream d = new FileInputStream("testSer2.ser");
			ObjectInputStream f = new ObjectInputStream(d);
			date = (Date) f.readObject();
			System.out.println(date.toString());
			f.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
